/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package arkin.impl;

import arkin.ActionDifferentialWheel;
import arkin.ArkinPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Action Differential Wheel</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link arkin.impl.ActionDifferentialWheelImpl#getRightValue <em>Right Value</em>}</li>
 *   <li>{@link arkin.impl.ActionDifferentialWheelImpl#getLeftValue <em>Left Value</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ActionDifferentialWheelImpl extends ActionImpl implements ActionDifferentialWheel {
	/**
	 * The default value of the '{@link #getRightValue() <em>Right Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRightValue()
	 * @generated
	 * @ordered
	 */
	protected static final double RIGHT_VALUE_EDEFAULT = 0.0;
	/**
	 * The cached value of the '{@link #getRightValue() <em>Right Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRightValue()
	 * @generated
	 * @ordered
	 */
	protected double rightValue = RIGHT_VALUE_EDEFAULT;
	/**
	 * The default value of the '{@link #getLeftValue() <em>Left Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLeftValue()
	 * @generated
	 * @ordered
	 */
	protected static final double LEFT_VALUE_EDEFAULT = 0.0;
	/**
	 * The cached value of the '{@link #getLeftValue() <em>Left Value</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLeftValue()
	 * @generated
	 * @ordered
	 */
	protected double leftValue = LEFT_VALUE_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActionDifferentialWheelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ArkinPackage.Literals.ACTION_DIFFERENTIAL_WHEEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getRightValue() {
		return rightValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRightValue(double newRightValue) {
		double oldRightValue = rightValue;
		rightValue = newRightValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__RIGHT_VALUE, oldRightValue, rightValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getLeftValue() {
		return leftValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLeftValue(double newLeftValue) {
		double oldLeftValue = leftValue;
		leftValue = newLeftValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__LEFT_VALUE, oldLeftValue, leftValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__RIGHT_VALUE:
				return getRightValue();
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__LEFT_VALUE:
				return getLeftValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__RIGHT_VALUE:
				setRightValue((Double)newValue);
				return;
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__LEFT_VALUE:
				setLeftValue((Double)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__RIGHT_VALUE:
				setRightValue(RIGHT_VALUE_EDEFAULT);
				return;
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__LEFT_VALUE:
				setLeftValue(LEFT_VALUE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__RIGHT_VALUE:
				return rightValue != RIGHT_VALUE_EDEFAULT;
			case ArkinPackage.ACTION_DIFFERENTIAL_WHEEL__LEFT_VALUE:
				return leftValue != LEFT_VALUE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (RightValue: ");
		result.append(rightValue);
		result.append(", LeftValue: ");
		result.append(leftValue);
		result.append(')');
		return result.toString();
	}

} //ActionDifferentialWheelImpl
